home *** CD-ROM | disk | FTP | other *** search
/ Mac Expert 1995 Winter / Mac Expert - Winter 95.iso / Les fichiers / Communications / Divers / DinkClass ƒ / DinkClass / DinkUtils.h < prev    next >
Encoding:
Text File  |  1992-12-31  |  2.1 KB  |  78 lines  |  [TEXT/KAHL]

  1. /*
  2.     File:        DinkUtils.h
  3.  
  4.     Contains:    xxx put contents here xxx
  5.  
  6.     Written by:    Mark Gross
  7.  
  8.     Copyright:    © 1992 by Applied Technical Software, all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <3>    12/31/92    MTG        making the code conditionaly compiled so         that I am
  13.                                     always working with a current         version in either think c
  14.                                     or MPW C++
  15.          <2>     9/20/92    MTG        Bringing the C++ code up to date with the THINKC version
  16.  
  17.     To Do:
  18. */
  19.  
  20. // these are the prototypes for the util fuctions
  21. // used in DinkClass
  22. #include <AppleEvents.h>
  23.  
  24.  
  25. void InitToolBox(int numMoreMasers);
  26. Boolean System7Available(void); 
  27. TrapType    GetTrapType(short theTrap);
  28. short    NumToolboxTraps(void);
  29. Boolean TrapExists(short theTrap);
  30.  
  31. // apple event stuff
  32.  
  33. OSErr RequiredCheck( AppleEvent *theAppleEvent);
  34.  
  35. //Str255 stuff
  36.  
  37. void    pstrcpy(Str255 dest, Str255 src);
  38. void    pstrcat(Str255 dest, Str255 src);
  39.  
  40.  
  41. #define HiWrd(aLong)    (short) (((aLong) >> 16) & 0xFFFF)
  42. #define LoWrd(aLong)    (short) ((aLong) & 0xFFFF)
  43.  
  44. #define Min(A,B)        ((A) < (B) ? (A) : (B) )
  45. #define Max(A,B)        ((A) < (B) ? (B) : (A) )
  46.  
  47. #define ZERO 0L
  48.  
  49. //
  50. // macros taken from CShell demo
  51. //
  52.  
  53. /* define our own abs() so we don't need StdLib */
  54. #define abs(val) (((val) < 0) ? (-(val)) : (val))
  55. /* Pascal string copy */
  56. #define PStrCopy(dest, src)    (BlockMove (src, dest, (*(char *)(src))+1))
  57.  
  58. #define TopLeft(r)        (* (Point *) &(r).top)
  59. #define BotRight(r)        (* (Point *) &(r).bottom)
  60.  
  61. #define SETPT(pt, x, y)    (*(pt)).h = (x); (*(pt)).v = (y)
  62. #define SETRECT(r, left, top, right, bottom)    \
  63.                         SETPT(&TopLeft(*(r)), (left), (top)); \
  64.                         SETPT(&BotRight(*(r)), (right), (bottom))
  65. /* 
  66.  *    Useful macros for testing gestalt attribute responses
  67.  *
  68.  *    BTstBool returns a true boolean value (0 or 1), but is slower than:
  69.  *    BTstQ which simply returns a non-zero value if the bit is set which
  70.  *    means the result could get lost if assigned to a short, for example.
  71.  *
  72.  *    arg is any integer value, bitnbr is the number of the bit to be tested.
  73.  *    bitnbr = 0 is the least significant bit.
  74.  */
  75. #define BTstBool(arg, bitnbr)    ((arg >> bitnbr) & 1)
  76. #define BTstQ(arg, bitnbr)        (arg & (1 << bitnbr))
  77.  
  78.